
var prefix = "/jzweb/jazSysLabel";

layui.use(['form', 'upload'], function(){
	var form = layui.form;
	var layer = layui.layer;
	var upload = layui.upload;

	//自定义验证规则
	form.verify({
		describe: function(value){
			if( !value ){
				return '请填写您的标签描述';
			}
		}
	});

	form.val('example', {
		"status": $("#status").val()
	});

	form.render();

	//提交事件
	form.on('submit(submit)', function(data){

		$.ajax({
			url : prefix+"/update",
			type : "post",
			data : data.field,
			success : function(r) {
				if (r.code==0) {
					layer.msg(r.msg);
					parent.layer.msg("操作成功");
					parent.load();
					var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
					parent.layer.close(index);
				}else{
					layer.msg(r.msg);
				}
			}
		});

		return false;
	});

});